package com.aos.erp.manager.service.mq;

import com.aos.erp.common.utils.JsonUtils;
import com.aos.erp.manager.model.review.vo.CheckResultFailVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;

@Slf4j
@Component
public class SenderSubmitted {

    @Autowired
    private AmqpTemplate rabbitTemplate;

    public void sendSubmit(List<String> dataList) {
        log.info("sendSubmit: " + JsonUtils.toJSONString(dataList));
        this.rabbitTemplate.convertAndSend(QueueConstants.gov_direct_exchange, QueueConstants.gov_direct_exchange_key_submitted, dataList);
    }

    public void sendSuccess(List<String> dataList) {
        log.info("sendSuccess: " + JsonUtils.toJSONString(dataList));
        this.rabbitTemplate.convertAndSend(QueueConstants.gov_direct_exchange, QueueConstants.gov_direct_exchange_key_success, dataList);
    }

    public void sendFail(List<CheckResultFailVo> dataList) {
        log.info("sendFail: " + JsonUtils.toJSONString(dataList));
        this.rabbitTemplate.convertAndSend(QueueConstants.gov_direct_exchange, QueueConstants.gov_direct_exchange_key_failed, dataList);
    }
}